<template>
    <div>
        <h1>显示</h1>
        <table class="table table-bordered">
            <tbody>
                <tr>
                    <td>Id</td>
                    <td>编号</td>
                    <td>门店名称胡</td>
                    <td>门店状态</td>
                    <td>状态</td>
                    <td>开业时间</td>
                    <td>门店电话</td>
                    <td>店长</td>
                    <td>店长电话</td>
                    <td>操作</td>
                </tr>

                 <tr v-for="itme in data.list":key="itme.Id">
                    <td>{{ itme.Id }}</td>
                    <td>{{ itme.BH }}</td>
                    <td>{{ itme.Name }}</td>
                    <td>{{ itme.SYName }}</td>
                    <td>{{ itme.State }}</td>
                    <td>{{ itme.OpenTime }}</td>
                    <td>{{ itme.Phone.substring(0,3)+'****'+itme.Phone.substring(7)}}</td>
                    <td>{{ itme.DZName }}</td>
                    <td>{{ itme.Tel.substring(0,3)+'****'+itme.Tel.substring(7) }}</td>
                    <td><input type="button" value="删除" @click="del(itme.Id)"></td>
                </tr>
            </tbody>
        </table>
    </div>
</template>

<script setup lang="ts">
import {ref,reactive, onMounted} from 'vue'
import axios from 'axios';
import { useRouter } from 'vue-router';
const router=useRouter();
let info:any=reactive({
    bh:'',
    names:'',
    state:'',
    pageIndex:1,
    pagesize:2
})
let data:any=reactive({
    list:[],
    totalcount:0,
    totalpage:0
})
onMounted(()=>{
    getlist();
})
const getlist=()=>{
    axios({
        url:'/api/MD/GetShou',
        method:'get',
        params:info
    })
    .then((res)=>{
        console.log(res);
        Object.assign(data,res.data)
        
    })
}
const del=(id:any)=>{
    axios({
        url:'/api/MD/Del',
        method:'delete',
        params:{id:id}
    })
    .then((res)=>{
        console.log(res);
         if(res.data>0)
    {
        alert('删除成功');
        getlist();
        return;
    }
    else
    {
        alert('删除失败');
        return;
    }
    })
    .catch((err)=>{
        console.log(err);
        
    })
}
</script>

<style scoped>

</style>